package com.wlz.ota.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author wlz
 * @date 2022-10-31  6:32 下午
 */
public class CommonUtil {

    /**
     * 正则校验
     */
    public static boolean checkRegular(String input, String regex) {
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(input);
        return matcher.matches();
    }

    public static boolean regularFind(String input, String regex) {
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(input);
        return matcher.find();
    }

    /**
     * 获取临时路径
     */
    public static String resolveTmpPath(String path) {
        return "/Library/intest/file/" + path;
    }
}
